<?

class bf_log {

	protected $opts;

	public function __construct($options = array()) {
		if (!is_array($options))
			$options = array('log' => $options);
		$this->opts = array_merge(array(
			'log' => dirname(__FILE__) . '/../logs/all.log',
		), $options);
	}

	public function append($msg) {
		if ($this->opts['log']) {
			if ($fp = @fopen($this->opts['log'], 'a')) {
				@flock($fp, LOCK_EX);
				@fseek($fp, 0, SEEK_END);
				@fwrite($fp, $msg);
				@flock($fp, LOCK_UN);
				@fclose($fp);
			}
		}
	}
}

?>